package cn.felord.security.autoconfigure.context;

import lombok.Data;
import org.springframework.lang.NonNull;

import java.util.Map;
import java.util.TreeMap;

/**
 * The type Client context.
 *
 * @author felord.cn
 * @since 2021 /8/6 17:22
 */
@Data
public class ClientContext {
    @NonNull
    private String clientId;
    private final Map<String, Object> additional = new TreeMap<>();

    /**
     * Add attribute.
     *
     * @param key   the key
     * @param value the value
     */
    public void addAttribute(String key, Object value) {
        this.additional.put(key, value);
    }

    /**
     * Add all attribute.
     *
     * @param attributes the attributes
     */
    public void addAllAttribute(Map<String, Object> attributes) {
        this.additional.putAll(attributes);
    }
}
